<?php

use yii\db\Schema;
use yii\db\Migration;

class m170703_061616_campaign_add_frequency_feild extends Migration
{
    public function up()
    {
        $this->addColumn('{{%campaign}}', 'frequency_control', 'int(1) NOT NULL DEFAULT 0 COMMENT "是否有联合频控" after day_budget');
        $this->addColumn('{{%campaign}}', 'frequency_control_type', 'int(10) NOT NULL DEFAULT 0 COMMENT "联合频控类型, condition_frequency_type id" after frequency_control');
        $this->addColumn('{{%campaign}}', 'frequency_upper_limit', 'int(10) NOT NULL DEFAULT 0 COMMENT "频次上限" after frequency_control_type');
        $this->addColumn('{{%campaign}}', 'frequency_lower_limit', 'int(10) NOT NULL DEFAULT 0 COMMENT "频次下限" after frequency_upper_limit');
        return $this->addColumn('{{%campaign}}', 'frequency_lower_start', 'date NOT NULL DEFAULT 0 COMMENT "频次下限开启时间,默认为投放开始时间" after frequency_lower_limit');

    }

    public function down()
    {
        echo "m170703_061616_campaign_add_frequency_feild cannot be reverted.\n";
        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
